<template>
  <van-tabbar v-model="tabarActive">
    <van-tabbar-item icon="wap-home" @click="redirect('/')">首页</van-tabbar-item>
    <!--<van-tabbar-item icon="apps-o" dot  @click="redirect('/cate')" >分类</van-tabbar-item>-->
    <van-tabbar-item icon="shopping-cart" :info="cartInfo" url="redirect('/shoppingCart')">购物车</van-tabbar-item>
    <van-tabbar-item icon="contact" dot url="redirect('/me')">我的</van-tabbar-item>
  </van-tabbar>
</template>
<script>
  import { mapState,mapActions,mapGetters } from 'vuex';
  export default {
    name: 'tabBar',
    data(){
      return {
        tabarActive:0
      }
    },
    props:{
      cartInfo:{
        type:Number,
        required:true,
        default(){
          return {
            cartInfo: 0
          }
        }
      },
      // tabarActive:{
      //   type:Number,
      //   required:true,
      //   default(){
      //     return {
      //       tabarActive: 0
      //     }
      //   }
      // }
    },
    methods:{
      tabbarChange(index){
        console.log(index)
      },
      redirect(url){
        this.$router.push(url);
      },
    }

  }
</script>
